<?php

namespace app\index\controller;
use think\Controller;
use think\facade\Hook;
use think\Db;
use think\Console;

class Mpdf extends Controller
{

    public function create()
    {
        $htmlContent = '
            <!DOCTYPE html>
            <html lang="en">
            <head>
                <meta charset="UTF-8">
            </head>
            <body>
            sdsds
            </body>
            </html>
            ';
        //$htmlContent = "hello world";

        $mpdf = new \Mpdf\Mpdf();
        $mpdf->SetDisplayMode('fullpage');
        $mpdf->autoScriptToLang = true;
        $mpdf->autoLangToFont = true;
        $mpdf->WriteHTML($htmlContent);

        $de = $mpdf->Output('test.pdf', \Mpdf\Output\Destination::DOWNLOAD);

        return $de;
    }

}
